package com.zsr.chapter04.servlet;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author zsr
 * @Description 实现网页定时刷新并跳转
 * @Version 1.0
 */
public class ReqServlet1 extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=utf-8");
        response.getWriter().print("用户注册成功，2秒后跳转首页");
        //自动跳转：2秒后跳转到另一个链接
        response.setHeader("refresh","2;URL=http://www.itcast.cn/");
    }
}
